	var webRoot = "./";   //定义网站的根目录
	$.ui.autoLaunch = false; //初始化
	$.ui.useOSThemes = false; //自动选择皮肤
	$.ui.openLinksNewTab = false; //禁止在新窗口打开页面
	$.ui.animateHeaders = false;  //禁止头部动画
	$.ui.splitview = false; //禁止大于某个分辨率自动展开菜单
	// $.ui.slideSideMenu = false; 禁止滑动打开nav
	// $.ui.animateHeaders = false //禁止顶部转场动画;
	//$.feat.nativeTouchScroll =false;  //禁用滚动条
	// $(".panel").attr("scrolling","no"); //禁用滚动条
	// 指定区域局部滑动 需要注释 // if ($.os.supportsTouch) $.touchLayer(afui);
	// var divs = $("#zjr_hd .inner div").scroller();
	// $("#zjr_hd .inner div").bind("touchmove", function (e) { e.stopPropagation(); })

	//欢迎页面
	 var init = function () {
	    $.ui.backButtonText = "Back";
	    window.setTimeout(function () {
	        $.ui.launch();
	    },10000);
	};

	document.addEventListener("DOMContentLoaded", init, true);

	//所有页面默认过度方式为slide
	$.ui.availableTransitions["default"] = $.ui.availableTransitions.slide;
	// 设置可下拉内容
	// window.addEventListener("load",function(){
	// 	    $(".index_inner").scroller({useJsScroll:true});     
	// },false);

	var _winwidth = $(window).width();
	var _winheight = $(window).height();
	$(document).ready(
		function(){
			$("html").css("fontSize",_winwidth/160*7+"px");
			$('.shijilieb.tsbgul').css('min-height',_winheight-80);
			var zhezhao = $(".zhezhao");
			var xuanze = $(".xf_xuanze");
			var Xzdq = $("#fb_xindz li");
			zhezhao.css({"width" :"100%","height" :_winheight + "px"});
			$("#navzz").css({"width" :"100%","height" :_winheight + "px"});
			xuanze.children("li").children("ul").children("li").children("a").css({"width" :_winwidth*0.42});
			zhezhao.children(".xz_shuji").css({"left" :_winwidth*0.02});
			zhezhao.children(".xz_fenlei").css({"left" :_winwidth*0.27});
			zhezhao.children(".xz_diqu").css({"left" :_winwidth*0.52});
			zhezhao.children(".xz_juli").css({"right" :5});
			$("#zjr_hd").css({"min-height":300});
			$(".sjxq_hd").children('div').children('ul').css({"height":_winheight-78});
			$("#tushuguan").children('div').children('ul').css({"height":_winheight-45});
			$("#zjr_hd").css({"height":_winheight-78});
			// $("#shuji_xq").css({"height":_winheight-42});
			// $("#zjr_hd .inner div").css({"height":_winheight-320,"width":_winwidth});
			$(" #fabzj_2 .shezhifb ul li ul li").css({"width":_winwidth*0.3,"height":_winwidth*0.3});
			// 点击顶部nav弹出内容
			xuanze.children("li").on("click",
				function(){
					var index = $(this).index();
					zhezhao.addClass("cur");
					zhezhao.children("ul").eq(index).css("display","block").siblings().css("display","none");
					$(this).find("ul").css("display","block").parent().siblings().find("ul").css("display","none");
				}
			);
			zhezhao.on("click",function(){$(this).removeClass("cur");});
			// 点击内容隐藏选择样式
			
			// 选择地址
			$("#fb_xzdz .xuanzedizhi li").on("click",function(){$(this).addClass("cur").siblings().removeClass("cur");});
			// 图使馆搜索后
			$(".dzssk a").on("click",
				function(){
					$("#tushuguan").hide();
					$("#tsg_top").hide();
					$(".tsgssjg").show();
				}
			);
			$(".dzssk i").on("click",
				function(){
					$("#bdduzz li").removeClass("cur");
					$("#tushuguan").show();
					$("#tsg_top").show();
					$(this).hide();
					$(".tsgssjg").hide();
				}
			);
			// 图书馆input xx按钮
			$(".dzssk input").keyup(function() {
				if($(this).val()!=''){
					$(".dzssk i").show();
				}else{
					$(".dzssk i").hide();
				}
			});

			// 新地址选择地区
			Xzdq.children("div").on("click",
				function(){
					$(this).css('background','url(images/icon_sxjs.png) 95% 50% no-repeat');
					$(this).siblings("ul").show();
				}
			);
			Xzdq.find("li").on("click",
				function(){
					$(this).parent().hide();
					$(this).parent().siblings("div").css('background','url(images/icon_xxsj.png) 95% 50% no-repeat');
					$.ui.scrollToTop("#fb_xindz");
				}
			);
			//点击搜索隐藏搜索记录
			$(".sscx_an").on("click",
				function(){
					$(".ssjilu").hide();
					$(".baisek").show();
					$(".tsbgul").show();
					$(".guanbixx").show();
					$(".shijilieb.tsbgul").css("background","#e6e6e6");
				}
			);
			// 点击出现xx按钮
			$(".sosuo input").keyup(function() {
				if($(this).val()!=''){
					$(".guanbixx").show();
				}else{
					$(".guanbixx").hide();
				}
			});
	     
	         // 点击启动滑动打开nav
	         $("[href='#index']").on("click",
			 	function(){
			 		 $.ui.slideSideMenu = true;
			 	}
			 );
	         // 点击删除图片
	        $("#fabzj_2 .shezhifb ul li ul li a").on("click",function(){$(this).parent().remove();});
			// $(".fabu").on("click",function(){alert('发布成功！');});
			// $(".xf_zc").on("click",function(){alert("注册成功!");});
			// $(".tijiao").on("click",function(){alert("提交成功！");});
			// $(".xf_denglu").on("click",function(){alert("登陆成功!");$(".xf_yonghuzt").hide();});
			// 改变nav图标颜色

			// 设置左侧nav z-index
			
		}
	);

	window.onload= function()
	{
	// 守信守时打分 原生js写法
		function dafen(id){
			var pinfen = document.getElementById(id).getElementsByTagName("input");
			for(var i=0;i < pinfen.length;i++){
				pinfen[i].onclick = function(){
					for(var i=0;i<pinfen.length;i++){
						pinfen[i].className='';
					}
					for(var i=0;i<this.name;i++){
						pinfen[i].className='cur';
					}
				}
			}
		};
		dafen('shoushi');//守信打分
		dafen('miaosu');//描述打分
	};

function init_carousel() {
	// banner切换
	if($("#bn_lb div").length>1){
		bn_lb=$("#bn_lb").carousel({
			preventDefaults:false,
			wrap:true //Set to false to disable the wrap around
		});
	}
	sjxq_hd=$("#sjxq_hd").carousel({
		pagingDiv: "carousel_dots2",
		pagingCssName: "carousel_paging2",
		pagingCssNameSelected: "carousel_paging2_selected",
		preventDefaults:false,
		wrap:false //Set to false to disable the wrap around
	});
	sjxqdt_hd=$("#sjxqdt_hd").carousel({
		pagingDiv: "carousel_dots3",
		pagingCssName: "carousel_paging3",
		pagingCssNameSelected: "carousel_paging3_selected",
		preventDefaults:false,
		wrap:false //Set to false to disable the wrap around
	});
	tushuguan=$("#tushuguan").carousel({
		pagingDiv: "carousel_dots4",
		pagingCssName: "carousel_pagin4",
		pagingCssNameSelected: "carousel_paging4_selected",
		preventDefaults:false,
		wrap:false //Set to false to disable the wrap around
	});
	zjr_hd=$("#zjr_hd").carousel({
		pagingDiv: "carousel_dots5",
		pagingCssName: "carousel_pagin5",
		pagingCssNameSelected: "carousel_paging5_selected",
		preventDefaults:false,
		wrap:false //Set to false to disable the wrap around
	});
}
init_carousel();
//window.addEventListener("load", init_carousel, false);




var myScroll,
pullDownEl, pullDownOffset,
pullUpEl, pullUpOffset,
generatedCount = 0;
/**
* 下拉刷新 （自定义实现此方法）
* myScroll.refresh();		// 数据加载完成后，调用界面更新方法
*/
function pullDownAction () {
	$('#wrapper').css('background','#e6e6e6');
	$('#index').css('background','#e6e6e6');
	indexPage=1;
	loadReleaseByCondition(indexPage);
}

/**
* 滚动翻页 （自定义实现此方法）
* myScroll.refresh();		// 数据加载完成后，调用界面更新方法
*/

function pullUpAction () {
	indexPage=indexPage+1;
	loadReleaseByCondition(indexPage);
}

/**
* 初始化iScroll控件
*/
function loaded() {
var pullDownEl = document.getElementById('pullDown');
pullDownOffset = pullDownEl.offsetHeight;
pullUpEl = document.getElementById('pullUp');	
pullUpOffset = pullUpEl.offsetHeight;

myScroll = new iScroll('wrapper', {
	scrollbarClass: 'myScrollbar', /* 重要样式 */
	useTransition: false, /* 此属性不知用意，本人从true改为false */
	topOffset: pullDownOffset,
	onRefresh: function () {
		if (pullDownEl.className.match('loading')) {
			pullDownEl.className = '';
			pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
		} else if (pullUpEl.className.match('loading')) {
			pullUpEl.className = '';
			pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
		}
	},
	onScrollMove: function () {
		if (this.y > 5 && !pullDownEl.className.match('flip')) {
			pullDownEl.className = 'flip';
			pullDownEl.querySelector('.pullDownLabel').innerHTML = '松手开始更新...';
			this.minScrollY = 0;
		} else if (this.y < 5 && pullDownEl.className.match('flip')) {
			pullDownEl.className = '';
			pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
			this.minScrollY = -pullDownOffset;
		} else if (this.y < (this.maxScrollY - 5) && !pullUpEl.className.match('flip')) {
			pullUpEl.className = 'flip';
			pullUpEl.querySelector('.pullUpLabel').innerHTML = '松手开始更新...';
			this.maxScrollY = this.maxScrollY;
		} else if (this.y > (this.maxScrollY + 5) && pullUpEl.className.match('flip')) {
			pullUpEl.className = '';
			pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
			this.maxScrollY = pullUpOffset;
		}
	},
	onScrollEnd: function () {
		if (pullDownEl.className.match('flip')) {
			pullDownEl.className = 'loading';
			pullDownEl.querySelector('.pullDownLabel').innerHTML = '加载中...';				
			pullDownAction();	// Execute custom function (ajax call?)
		} else if (pullUpEl.className.match('flip')) {
			pullUpEl.className = 'loading';
			pullUpEl.querySelector('.pullUpLabel').innerHTML = '加载中...';				
			pullUpAction();	// Execute custom function (ajax call?)
		}
	}
});

setTimeout(function () { document.getElementById('wrapper').style.left = '0'; }, 800);
pullDownAction();
}
document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);





// 点击发送短信
$(function(){
	var judphone=true;
	var timer1=null;
	var sum=60;
	$("#jieshoudx").click(function(){
		if(judphone){
			var sum=60;
        		judphone=false;
        		$("#jieshoudx").val(sum+"秒后可再获取")
				timer1=setInterval(function(){
					sum--;
					$("#jieshoudx").val(sum+"秒后可再获取");
					if(sum==0){
						clearInterval(timer1)
						judphone=true;
						$("#jieshoudx").val("获取验证码")
					}
				},1000)
		}
	})
})


//返回val的字节长度
function getByteLen(val) {
    var len = 0;
    for (var i = 0; i < val.length; i++) {
        // if (val[i].match(/[^\x00-\xff]/ig) != null) //全角
        //     len += 2;
        // else
            len += 1;
    }
    return len;
}

//返回val在规定字节长度max内的值
function getByteVal(val, max) {
    var returnValue = '';
    var byteValLen = 0;
    for (var i = 0; i < val.length; i++) {
        if (val[i].match(/[^\x00-\xff]/ig) != null)
        //     byteValLen += 2;
        // else
            byteValLen += 1;

        if (byteValLen > max)
            break;

        returnValue += val[i];
    }
    return returnValue;
}


$(function() {
    var _area = $('textarea#wenbenk');
    var _info = $("#shengysl");
    var _max = _area.attr('maxlength');
    var _val="";
    var _cur=0;
    function value1(){
        if (_cur == 0) {//当默认值长度为0时,可输入数为默认maxlength值
            _info.text(_max);
        } else if (_cur < _max) {//当默认值小于限制数时,可输入数为max-cur
            _info.text(_max - _cur);
        } else {//当默认值大于等于限制数时
            _info.text(0);
            _area.val(getByteVal(_val,_max)); //截取指定字节长度内的值
        }
    }
     _val = _area.val();
    _cur = getByteLen(_val);

    value1();
    
    _area.bind('keyup', function() { //绑定keyup事件

        _val = $(this).val();
        _cur = getByteLen(_val);

       value1();
    });
});